package com.ddd.mill.domain.aggregate.constant.product.constant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @author liu
 * @title: ProductStatusEnum
 * @projectName trading-center
 * @date 2020/11/3010:07
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ProductStatusEnum {
    /**
     *
     */
    NOT_ON_SALE(1, "未上架"),
    PUT_ON_SALE(1, "上架中"),
    PUT_ON_SHELVES(1, "已下架");

    @EnumValue
    private final Integer value;
    private final String desc;

    ProductStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    @JsonCreator
    public static ProductStatusEnum get(Integer value){
        for (ProductStatusEnum e : ProductStatusEnum.values()) {
            if (e.getValue().equals(value)) {
                return e;
            }
        }
        return null;
    }
}
